package com.ssmbook2020.dao;

import java.util.List;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.jdbc.core.BeanPropertyRowMapper;
import org.springframework.jdbc.core.JdbcTemplate;
import org.springframework.stereotype.Repository;

import com.ssmbook2020.bean.BookBean;

@Repository("bookdao")
public class BookDaoImpl implements BookDAO {

    //peng08
	@Autowired //从springxml配置中自动注入该对象
	private JdbcTemplate jdbcTemplate;
	
	
	
	public void setJdbcTemplate(JdbcTemplate jdbcTemplate) {
		this.jdbcTemplate = jdbcTemplate;
	}

	@Override
	public List<BookBean> getAllBooks() {
		String sql="select * from tbBook";
		return jdbcTemplate.query(sql, new BeanPropertyRowMapper(BookBean.class));
	}

	@Override
	public int getGoodsCount() {
		// TODO Auto-generated method stub
		return 0;
	}

	@Override
	public BookBean getBookById(String bookId) {
		// TODO Auto-generated method stub
		return null;
	}

	@Override
	public int addBook(BookBean bookBean) {
		// TODO Auto-generated method stub
		return 0;
	}

	@Override
	public int updateBook(BookBean bookBean, String bookId) {
		// TODO Auto-generated method stub
		return 0;
	}

}
